<template>
  <div class="home-page">
    <div class="title">盛E签</div>
    <van-tabs
      v-model:active="tabsActive"
      class="home-tabs"
      title-active-color="#2489f2"
    >
      <van-tab v-for="item in tabActive" :key="item.name" :name="item.name">
        <template #title>
          <div class="tab-title">
            <svg-icon
              :name="item.name"
              className="svg-class"
              :color="tabsActive === item.name ? '#2489f2' : '#515151'"
            ></svg-icon>
            <span>{{ item.title }}</span>
          </div>
        </template>
      </van-tab>
    </van-tabs>
    <component :is="tabsActive"></component>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import MySign from './component/my-sign.vue'
import MyApprove from './component/my-approve.vue'
import HeOperation from './component/he-operation.vue'
import SuccessSign from './component/success-sign.vue'
export default defineComponent({
  components: { MySign, MyApprove, HeOperation, SuccessSign },
  setup() {
    const tabActive = [
      { name: 'my-sign', title: '待我签署' },
      { name: 'my-approve', title: '待我审批' },
      { name: 'he-operation', title: '他人操作' },
      { name: 'success-sign', title: '签约完成' }
    ]
    const tabsActive = ref('my-sign')

    return { tabActive, tabsActive }
  }
})
</script>

<style scoped lang="less">
.home-page {
  height: 100%;
  width: 100%;
  .title {
    height: 46px;
    background-color: #fff;
    text-align: center;
    line-height: 46px;
    font-size: 17px;
    font-weight: 700;
  }
  .home-tabs {
    :deep(.van-tabs__wrap) {
      height: 86px;
    }
    :deep(.van-tabs__line) {
      background-color: #2489f2 !important;
    }
    .tab-title {
      height: 86px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .svg-class {
        width: 22px !important;
        height: 22px !important;
        margin-bottom: 10px;
      }
    }
  }
}
</style>
